
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:massagist/manager/config.dart';
import 'package:massagist/pages/web_page.dart';

import '../generated/l10n.dart';
import '../views/all_dialogs.dart';

class MinePage extends StatefulWidget {
  @override
  State<MinePage> createState() => MinePageState();
}

class MinePageState extends State<MinePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      extendBodyBehindAppBar: true,
      appBar:  AppBar(
        iconTheme: IconThemeData(color: Colors.white),
        centerTitle: true,
        title: Text(S.current.TAB_MINE_TEXT, style: NaviTitleStyle,),
        backgroundColor: Colors.transparent,
        shadowColor: Colors.transparent,
        elevation: 0,
      ),
      body: Container(
        child: Stack(
          children: [
            Container(
              width: double.infinity,
              child: Image.asset( 'assets/images/path_head.png', fit: BoxFit.fitWidth, ),
            ),
            Container(
              margin: EdgeInsets.only(left: 16.sp, right: 16.sp, top: 100.sp),
              child: Column(
                children: [
                  Row(
                    children: [
                      Container(
                        child: Image.asset("assets/images/head_icon.png", width: 69.sp, height: 69.sp,),
                      ),
                      Container(
                        margin: EdgeInsets.only(left: 12.sp),
                        child: Text("用户 09050552", style: TextStyle(fontWeight: FontWeight.w700, fontSize: 17.sp, color: Color(0xFF110604)),),
                      )
                    ],
                  ),
                  Container(
                    margin: EdgeInsets.only(top: 40.sp),
                    padding: EdgeInsets.only(left: 12.sp, right: 12.sp, top: 24.sp, bottom: 24.sp),
                    child: Column(
                      children: [
                        Container(
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: [
                              Row(
                                children: [
                                  Image.asset("assets/images/mine/service.png", width: 24.sp, height: 24.sp,),
                                  Container(
                                    margin: EdgeInsets.only(left: 12.sp),
                                    child: Text(S.current.MINE_SERVICE_PHONE_TEXT, style: TextStyle(fontWeight: FontWeight.w500, fontSize: 15.sp, color: Color(0xFF333333)),),
                                  )
                                ],
                              ),

                              Container(
                                margin: EdgeInsets.only(left: 12.sp),
                                alignment: Alignment.centerRight,
                                child: Text(Config.userInfo.kefu, style: TextStyle(fontSize: 15.sp, color: Color(0xFF333333)),),
                              )
                            ],
                          ),
                        ),
                        Container(
                          margin: EdgeInsets.only(top: 24.sp),
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: [
                              Row(
                                children: [
                                  Image.asset("assets/images/mine/using.png", width: 24.sp, height: 24.sp,),
                                  Container(
                                    margin: EdgeInsets.only(left: 12.sp),
                                    child: Text(S.current.MINE_SERVICE_MANUAL_TEXT, style: TextStyle(fontWeight: FontWeight.w500, fontSize: 15.sp, color: Color(0xFF333333)),),
                                  )
                                ],
                              ),

                              Icon(Icons.arrow_forward_ios_rounded, color: Color(0xFF333333), size: 10.sp,)
                            ],
                          ),
                        ),
                        GestureDetector(
                          child: Container(
                            margin: EdgeInsets.only(top: 24.sp),
                            child: Row(
                              mainAxisAlignment: MainAxisAlignment.spaceBetween,
                              children: [
                                Row(
                                  children: [
                                    Image.asset("assets/images/mine/privacy.png", width: 24.sp, height: 24.sp,),
                                    Container(
                                      margin: EdgeInsets.only(left: 12.sp),
                                      child: Text(S.current.MINE_PRIVACY_TEXT, style: TextStyle(fontWeight: FontWeight.w500, fontSize: 15.sp, color: Color(0xFF333333)),),
                                    )
                                  ],
                                ),

                                Icon(Icons.arrow_forward_ios_rounded, color: Color(0xFF333333), size: 10.sp,)
                              ],
                            ),
                          ),
                          onTap: () {
                            Navigator.push(
                              context,
                              MaterialPageRoute(builder: (context) =>  WebPage(path: PRIVACY_ARGEEMENT,)),
                            );
                          },
                        )
                      ],
                    ),
                  ),
                  Container(
                    child: Column(
                      children: [
                        GestureDetector(
                          child: Container(
                            height: 50.sp,
                            alignment: Alignment.center,
                            child: Text(S.current.MINE_CLOSE_ACCOUNT, style: TextStyle(fontWeight: FontWeight.w500, fontSize: 15.sp, color: Color(0xFF333333)),),
                          ),
                          onTap: () {
                            showCloseAccountDialog(context);
                          },
                        ),
                        GestureDetector(
                          child: Container(
                            margin: EdgeInsets.only(top: 12.sp),
                            height: 50.sp,
                            alignment: Alignment.center,
                            child: Text(S.current.MINE_LOGOUT, style: TextStyle(fontWeight: FontWeight.w500, fontSize: 15.sp, color: Color(0xFF333333)),),
                          ),
                          onTap: () {
                            showLogoutAccountDialog(context);
                          },
                        )
                      ],
                    ),
                  )
                ],
              ),
            )
          ],
        ),
      ),
    );
  }
}